<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<% String contextPath = request.getContextPath(); %>
<% Map<String, String> cmap = (Map<String, String>)request.getAttribute("cmap"); %>
<% Map<String, String> pmap = (Map<String, String>)request.getAttribute("pmap"); %>
<% Integer quantity = (Integer)request.getAttribute("quantity"); %>
<% String[] numbers = (String[])request.getAttribute("numbers"); %>
<% List<Map<String, String>> olist = (List<Map<String, String>>)request.getAttribute("olist"); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="Refresh" content="60">
		<link rel="stylesheet" href="<%= contextPath %>/css/style.css" type="text/css" />
		<style type="text/css">  
		<!-- 
			td {
				padding: 0.5em;
			}
		-->  
		</style>  
		<title>Sample</title>
	</head>
	<body>
		<p style="margin-bottom:2em">
			<a href="./" class="button">戻る</a>
		</p>
		<% if (cmap != null) { %>
		<p>顧客情報</p>
		<table border="1" cellspacing="0">
			<tr>
				<td>顧客番号</td>
				<td><%= cmap.get("number") %></td>
			</tr>
			<tr>
				<td>名前</td>
				<td><%= cmap.get("name") %></td>
			</tr>
			<tr>
				<td>住所</td>
				<td><%= cmap.get("address") %></td>
			</tr>
			<tr>
				<td>電話番号</td>
				<td><%= cmap.get("tel") %></td>
			</tr>
		</table>
		<% } %>
		<% if (pmap != null) { %>
		<p>商品情報</p>
		<table border="1" cellspacing="0">
			<tr>
				<td>商品番号</td>
				<td><%= pmap.get("number") %></td>
			</tr>
			<tr>
				<td>商品名</td>
				<td><%= pmap.get("name") %></td>
			</tr>
			<tr>
				<td>単価</td>
				<td><%= pmap.get("price") %></td>
			</tr>
		</table>
		<% } %>
		<% if (quantity != null) { %>
		<p>在庫情報</p>
		<table border="1" cellspacing="0">
			<tr>
				<td>商品番号</td>
				<td><%= request.getParameter("stock") %></td>
			</tr>
			<tr>
				<td>在庫数</td>
				<td><%= quantity %></td>
			</tr>
		</table>
		<% } %>
		<% if (numbers != null) { %>
		<br />
		<table border="1" cellspacing="0">
			<tr>
				<td>発注番号</td>
			</tr>
			<% for (String number : numbers ) { %>
			<tr>
				<td><%= number %></td>
			</tr>
			<% } %>
		</table>
		<% } %>
		<% if (olist != null) { %>
		<br />
		<table border="1" cellspacing="0">
			<tr>
				<td>商品番号</td>
				<td>単価</td>
				<td>受注数</td>
				<td>配送状況</td>
			</tr>
			<% for (Map<String,String> m : olist) { %>
			<tr>
				<td><%= m.get("product") %></td>
				<td><%= m.get("price") %></td>
				<td><%= m.get("quantity") %></td>
				<td><%= m.get("info") %></td>
			</tr>
			<% } %>
		</table>
		<% } %>
	</body>
</html>